
package cn.edu.scau.cmi.hombio.service;

import cn.edu.scau.cmi.hombio.domain.CurePig;
import cn.edu.scau.cmi.hombio.domain.Pig;
import cn.edu.scau.cmi.hombio.domain.PigType;
import cn.edu.scau.cmi.hombio.domain.PigWeight;
import cn.edu.scau.cmi.hombio.domain.SalePig;
import cn.edu.scau.cmi.hombio.domain.TaskPig;
import cn.edu.scau.cmi.hombio.domain.Transfer;

import java.util.List;
import java.util.Set;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;

import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Class to run the service as a JUnit test. Each operation in the service is a separate test.
 *
 */

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
		DependencyInjectionTestExecutionListener.class,
		DirtiesContextTestExecutionListener.class,
		TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = {
		"file:./resources/pigRs-security-context.xml",
		"file:./resources/pigRs-service-context.xml",
		"file:./resources/pigRs-dao-context.xml",
		"file:./resources/pigRs-web-context.xml" })
@Transactional
public class PigServiceTest {

	/**
	 * The Spring application context.
	 *
	 */
	@SuppressWarnings("unused")
	private ApplicationContext context;

	/**
	 * The service being tested, injected by Spring.
	 *
	 */
	@Autowired
	protected PigService service;

	/**
	 * Instantiates a new PigServiceTest.
	 *
	 */
	public PigServiceTest() {
		setupRequestContext();
	}

	/**
	 * Operation Unit Test
	* Delete an existing CurePig entity
	* 
	 */
	@Test
	public void deletePigCurePigs() {
		// TODO: JUnit - Populate test inputs for operation: deletePigCurePigs 
		Integer pig_id = 0;
		Integer related_curepigs_id = 0;
		Pig response = null;
		response = service.deletePigCurePigs(pig_id, related_curepigs_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigCurePigs
	}

	/**
	 * Operation Unit Test
	* Delete an existing Pig entity
	* 
	 */
	@Test
	public void deletePigPigByThirdLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: deletePigPigByThirdLikelyMaleParentId 
		Integer pig_id_1 = 0;
		Integer related_pigbythirdlikelymaleparentid_id = 0;
		Pig response = null;
		response = service.deletePigPigByThirdLikelyMaleParentId(pig_id_1, related_pigbythirdlikelymaleparentid_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigPigByThirdLikelyMaleParentId
	}

	/**
	 * Operation Unit Test
	* Delete an existing PigType entity
	* 
	 */
	@Test
	public void deletePigPigType() {
		// TODO: JUnit - Populate test inputs for operation: deletePigPigType 
		Integer pig_id_2 = 0;
		Integer related_pigtype_id = 0;
		Pig response = null;
		response = service.deletePigPigType(pig_id_2, related_pigtype_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigPigType
	}

	/**
	 * Operation Unit Test
	* Save an existing Pig entity
	* 
	 */
	@Test
	public void savePigPigByFemaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: savePigPigByFemaleParentId 
		Integer id = 0;
		Pig related_pigbyfemaleparentid = new cn.edu.scau.cmi.hombio.domain.Pig();
		Pig response = null;
		response = service.savePigPigByFemaleParentId(id, related_pigbyfemaleparentid);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigPigByFemaleParentId
	}

	/**
	 * Operation Unit Test
	* Save an existing Pig entity
	* 
	 */
	@Test
	public void savePigPigBySecondLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: savePigPigBySecondLikelyMaleParentId 
		Integer id_1 = 0;
		Pig related_pigbysecondlikelymaleparentid = new cn.edu.scau.cmi.hombio.domain.Pig();
		Pig response = null;
		response = service.savePigPigBySecondLikelyMaleParentId(id_1, related_pigbysecondlikelymaleparentid);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigPigBySecondLikelyMaleParentId
	}

	/**
	 * Operation Unit Test
	 */
	@Test
	public void findPigByPrimaryKey() {
		// TODO: JUnit - Populate test inputs for operation: findPigByPrimaryKey 
		Integer id_2 = 0;
		Pig response = null;
		response = service.findPigByPrimaryKey(id_2);
		// TODO: JUnit - Add assertions to test outputs of operation: findPigByPrimaryKey
	}

	/**
	 * Operation Unit Test
	* Delete an existing Pig entity
	* 
	 */
	@Test
	public void deletePigPigsForMostLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: deletePigPigsForMostLikelyMaleParentId 
		Integer pig_id_3 = 0;
		Integer related_pigsformostlikelymaleparentid_id = 0;
		Pig response = null;
		response = service.deletePigPigsForMostLikelyMaleParentId(pig_id_3, related_pigsformostlikelymaleparentid_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigPigsForMostLikelyMaleParentId
	}

	/**
	 * Operation Unit Test
	* Load an existing Pig entity
	* 
	 */
	@Test
	public void loadPigs() {
		Set<Pig> response = null;
		response = service.loadPigs();
		// TODO: JUnit - Add assertions to test outputs of operation: loadPigs
	}

	/**
	 * Operation Unit Test
	* Delete an existing SalePig entity
	* 
	 */
	@Test
	public void deletePigSalePigs() {
		// TODO: JUnit - Populate test inputs for operation: deletePigSalePigs 
		Integer pig_id_4 = 0;
		Integer related_salepigs_id = 0;
		Pig response = null;
		response = service.deletePigSalePigs(pig_id_4, related_salepigs_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigSalePigs
	}

	/**
	 * Operation Unit Test
	* Save an existing Pig entity
	* 
	 */
	@Test
	public void savePigPigsForThirdLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: savePigPigsForThirdLikelyMaleParentId 
		Integer id_3 = 0;
		Pig related_pigsforthirdlikelymaleparentid = new cn.edu.scau.cmi.hombio.domain.Pig();
		Pig response = null;
		response = service.savePigPigsForThirdLikelyMaleParentId(id_3, related_pigsforthirdlikelymaleparentid);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigPigsForThirdLikelyMaleParentId
	}

	/**
	 * Operation Unit Test
	* Return all Pig entity
	* 
	 */
	@Test
	public void findAllPigs() {
		// TODO: JUnit - Populate test inputs for operation: findAllPigs 
		Integer startResult = 0;
		Integer maxRows = 0;
		List<Pig> response = null;
		response = service.findAllPigs(startResult, maxRows);
		// TODO: JUnit - Add assertions to test outputs of operation: findAllPigs
	}

	/**
	 * Operation Unit Test
	* Delete an existing Pig entity
	* 
	 */
	@Test
	public void deletePig() {
		// TODO: JUnit - Populate test inputs for operation: deletePig 
		Pig pig = new cn.edu.scau.cmi.hombio.domain.Pig();
		service.deletePig(pig);
	}

	/**
	 * Operation Unit Test
	* Delete an existing PigWeight entity
	* 
	 */
	@Test
	public void deletePigPigWeights() {
		// TODO: JUnit - Populate test inputs for operation: deletePigPigWeights 
		Integer pig_id_5 = 0;
		Integer related_pigweights_id = 0;
		Pig response = null;
		response = service.deletePigPigWeights(pig_id_5, related_pigweights_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigPigWeights
	}

	/**
	 * Operation Unit Test
	* Save an existing Pig entity
	* 
	 */
	@Test
	public void savePig() {
		// TODO: JUnit - Populate test inputs for operation: savePig 
		Pig pig_1 = new cn.edu.scau.cmi.hombio.domain.Pig();
		service.savePig(pig_1);
	}

	/**
	 * Operation Unit Test
	* Save an existing SalePig entity
	* 
	 */
	@Test
	public void savePigSalePigs() {
		// TODO: JUnit - Populate test inputs for operation: savePigSalePigs 
		Integer id_4 = 0;
		SalePig related_salepigs = new cn.edu.scau.cmi.hombio.domain.SalePig();
		Pig response = null;
		response = service.savePigSalePigs(id_4, related_salepigs);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigSalePigs
	}

	/**
	 * Operation Unit Test
	* Delete an existing Pig entity
	* 
	 */
	@Test
	public void deletePigPigsForFemaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: deletePigPigsForFemaleParentId 
		Integer pig_id_6 = 0;
		Integer related_pigsforfemaleparentid_id = 0;
		Pig response = null;
		response = service.deletePigPigsForFemaleParentId(pig_id_6, related_pigsforfemaleparentid_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigPigsForFemaleParentId
	}

	/**
	 * Operation Unit Test
	* Delete an existing TaskPig entity
	* 
	 */
	@Test
	public void deletePigTaskPigs() {
		// TODO: JUnit - Populate test inputs for operation: deletePigTaskPigs 
		Integer pig_id_7 = 0;
		Integer related_taskpigs_id = 0;
		Pig response = null;
		response = service.deletePigTaskPigs(pig_id_7, related_taskpigs_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigTaskPigs
	}

	/**
	 * Operation Unit Test
	* Return a count of all Pig entity
	* 
	 */
	@Test
	public void countPigs() {
		Integer response = null;
		response = service.countPigs();
		// TODO: JUnit - Add assertions to test outputs of operation: countPigs
	}

	/**
	 * Operation Unit Test
	* Delete an existing Pig entity
	* 
	 */
	@Test
	public void deletePigPigByMostLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: deletePigPigByMostLikelyMaleParentId 
		Integer pig_id_8 = 0;
		Integer related_pigbymostlikelymaleparentid_id = 0;
		Pig response = null;
		response = service.deletePigPigByMostLikelyMaleParentId(pig_id_8, related_pigbymostlikelymaleparentid_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigPigByMostLikelyMaleParentId
	}

	/**
	 * Operation Unit Test
	* Delete an existing Transfer entity
	* 
	 */
	@Test
	public void deletePigTransfers() {
		// TODO: JUnit - Populate test inputs for operation: deletePigTransfers 
		Integer pig_id_9 = 0;
		Integer related_transfers_id = 0;
		Pig response = null;
		response = service.deletePigTransfers(pig_id_9, related_transfers_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigTransfers
	}

	/**
	 * Operation Unit Test
	* Save an existing CurePig entity
	* 
	 */
	@Test
	public void savePigCurePigs() {
		// TODO: JUnit - Populate test inputs for operation: savePigCurePigs 
		Integer id_5 = 0;
		CurePig related_curepigs = new cn.edu.scau.cmi.hombio.domain.CurePig();
		Pig response = null;
		response = service.savePigCurePigs(id_5, related_curepigs);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigCurePigs
	}

	/**
	 * Operation Unit Test
	* Save an existing Pig entity
	* 
	 */
	@Test
	public void savePigPigByThirdLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: savePigPigByThirdLikelyMaleParentId 
		Integer id_6 = 0;
		Pig related_pigbythirdlikelymaleparentid = new cn.edu.scau.cmi.hombio.domain.Pig();
		Pig response = null;
		response = service.savePigPigByThirdLikelyMaleParentId(id_6, related_pigbythirdlikelymaleparentid);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigPigByThirdLikelyMaleParentId
	}

	/**
	 * Operation Unit Test
	* Save an existing Transfer entity
	* 
	 */
	@Test
	public void savePigTransfers() {
		// TODO: JUnit - Populate test inputs for operation: savePigTransfers 
		Integer id_7 = 0;
		Transfer related_transfers = new cn.edu.scau.cmi.hombio.domain.Transfer();
		Pig response = null;
		response = service.savePigTransfers(id_7, related_transfers);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigTransfers
	}

	/**
	 * Operation Unit Test
	* Save an existing Pig entity
	* 
	 */
	@Test
	public void savePigPigsForFemaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: savePigPigsForFemaleParentId 
		Integer id_8 = 0;
		Pig related_pigsforfemaleparentid = new cn.edu.scau.cmi.hombio.domain.Pig();
		Pig response = null;
		response = service.savePigPigsForFemaleParentId(id_8, related_pigsforfemaleparentid);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigPigsForFemaleParentId
	}

	/**
	 * Operation Unit Test
	* Save an existing TaskPig entity
	* 
	 */
	@Test
	public void savePigTaskPigs() {
		// TODO: JUnit - Populate test inputs for operation: savePigTaskPigs 
		Integer id_9 = 0;
		TaskPig related_taskpigs = new cn.edu.scau.cmi.hombio.domain.TaskPig();
		Pig response = null;
		response = service.savePigTaskPigs(id_9, related_taskpigs);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigTaskPigs
	}

	/**
	 * Operation Unit Test
	* Save an existing Pig entity
	* 
	 */
	@Test
	public void savePigPigsForSecondLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: savePigPigsForSecondLikelyMaleParentId 
		Integer id_10 = 0;
		Pig related_pigsforsecondlikelymaleparentid = new cn.edu.scau.cmi.hombio.domain.Pig();
		Pig response = null;
		response = service.savePigPigsForSecondLikelyMaleParentId(id_10, related_pigsforsecondlikelymaleparentid);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigPigsForSecondLikelyMaleParentId
	}

	/**
	 * Operation Unit Test
	* Save an existing PigType entity
	* 
	 */
	@Test
	public void savePigPigType() {
		// TODO: JUnit - Populate test inputs for operation: savePigPigType 
		Integer id_11 = 0;
		PigType related_pigtype = new cn.edu.scau.cmi.hombio.domain.PigType();
		Pig response = null;
		response = service.savePigPigType(id_11, related_pigtype);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigPigType
	}

	/**
	 * Operation Unit Test
	* Save an existing PigWeight entity
	* 
	 */
	@Test
	public void savePigPigWeights() {
		// TODO: JUnit - Populate test inputs for operation: savePigPigWeights 
		Integer id_12 = 0;
		PigWeight related_pigweights = new cn.edu.scau.cmi.hombio.domain.PigWeight();
		Pig response = null;
		response = service.savePigPigWeights(id_12, related_pigweights);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigPigWeights
	}

	/**
	 * Operation Unit Test
	* Delete an existing Pig entity
	* 
	 */
	@Test
	public void deletePigPigByFemaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: deletePigPigByFemaleParentId 
		Integer pig_id_10 = 0;
		Integer related_pigbyfemaleparentid_id = 0;
		Pig response = null;
		response = service.deletePigPigByFemaleParentId(pig_id_10, related_pigbyfemaleparentid_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigPigByFemaleParentId
	}

	/**
	 * Operation Unit Test
	* Save an existing Pig entity
	* 
	 */
	@Test
	public void savePigPigByMostLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: savePigPigByMostLikelyMaleParentId 
		Integer id_13 = 0;
		Pig related_pigbymostlikelymaleparentid = new cn.edu.scau.cmi.hombio.domain.Pig();
		Pig response = null;
		response = service.savePigPigByMostLikelyMaleParentId(id_13, related_pigbymostlikelymaleparentid);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigPigByMostLikelyMaleParentId
	}

	/**
	 * Operation Unit Test
	* Save an existing Pig entity
	* 
	 */
	@Test
	public void savePigPigsForMostLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: savePigPigsForMostLikelyMaleParentId 
		Integer id_14 = 0;
		Pig related_pigsformostlikelymaleparentid = new cn.edu.scau.cmi.hombio.domain.Pig();
		Pig response = null;
		response = service.savePigPigsForMostLikelyMaleParentId(id_14, related_pigsformostlikelymaleparentid);
		// TODO: JUnit - Add assertions to test outputs of operation: savePigPigsForMostLikelyMaleParentId
	}

	/**
	 * Operation Unit Test
	* Delete an existing Pig entity
	* 
	 */
	@Test
	public void deletePigPigsForThirdLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: deletePigPigsForThirdLikelyMaleParentId 
		Integer pig_id_11 = 0;
		Integer related_pigsforthirdlikelymaleparentid_id = 0;
		Pig response = null;
		response = service.deletePigPigsForThirdLikelyMaleParentId(pig_id_11, related_pigsforthirdlikelymaleparentid_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigPigsForThirdLikelyMaleParentId
	}

	/**
	 * Operation Unit Test
	* Delete an existing Pig entity
	* 
	 */
	@Test
	public void deletePigPigBySecondLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: deletePigPigBySecondLikelyMaleParentId 
		Integer pig_id_12 = 0;
		Integer related_pigbysecondlikelymaleparentid_id = 0;
		Pig response = null;
		response = service.deletePigPigBySecondLikelyMaleParentId(pig_id_12, related_pigbysecondlikelymaleparentid_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigPigBySecondLikelyMaleParentId
	}

	/**
	 * Operation Unit Test
	* Delete an existing Pig entity
	* 
	 */
	@Test
	public void deletePigPigsForSecondLikelyMaleParentId() {
		// TODO: JUnit - Populate test inputs for operation: deletePigPigsForSecondLikelyMaleParentId 
		Integer pig_id_13 = 0;
		Integer related_pigsforsecondlikelymaleparentid_id = 0;
		Pig response = null;
		response = service.deletePigPigsForSecondLikelyMaleParentId(pig_id_13, related_pigsforsecondlikelymaleparentid_id);
		// TODO: JUnit - Add assertions to test outputs of operation: deletePigPigsForSecondLikelyMaleParentId
	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Sets Up the Request context
	 *
	 */
	private void setupRequestContext() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
	}
}
